var LANGUAGE_CODE = ''
if (localStorage.LANGUAGE_CODE == undefined) {
	LANGUAGE_CODE = "en_US"; //标识语言
} else {
	LANGUAGE_CODE = localStorage.LANGUAGE_CODE
}


function loadProperties(type) {
	jQuery.i18n.properties({
		name: 'strings', // 资源文件名称
		path: 'static/', // 资源文件所在目录路径
		mode: 'map', // 模式：变量或 Map 
		language: type, // 对应的语言
		cache: false,
		encoding: 'UTF-8',
		callback: function() { // 回调方法    
			$('#text').html($.i18n.prop('string_text'));
			$('#lang').html($.i18n.prop('string_lang'));
			$('#name').html($.i18n.prop('string_name')); //中引文名字 切换
		}
	});
}

function switchLang() {
	LANGUAGE_CODE = LANGUAGE_CODE == 'zh_CN' ? 'en_US' : 'zh_CN';
	console.log(LANGUAGE_CODE)
	// 设置当前的 语言缓存进入 js
	localStorage.setItem("LANGUAGE_CODE", LANGUAGE_CODE);
	loadProperties(LANGUAGE_CODE);
}

$(document).ready(function() {
	// LANGUAGE_CODE = jQuery.i18n.normaliseLanguageCode({}); //获取浏览器的语言     
	loadProperties(LANGUAGE_CODE);
})
